home *** CD-ROM | disk | FTP | other *** search
- # Source Generated with Decompyle++
- # File: in.pyo (Python 2.5)
-
- import sys
- import os
- USE_PEAK = False
- if USE_PEAK:
- import peak
- peak.install()
-
-
- try:
- import svnrev
- svnrev.REVISION
- except Exception:
- sys.REVISION = 'dev'
-
- sys.REVISION = svnrev.REVISION
-
- try:
- import devmode
- except Exception:
- sys.DEV = False
-
- sys.DEV = devmode.awesome
- sepjoin = os.pathsep.join
- pathjoin = os.path.join
- lib_dir = pathjoin(os.path.dirname(sys.executable), 'lib')
- os.environ['PATH'] = sepjoin([
- os.environ['PATH'],
- lib_dir])
- if USE_PEAK:
-
- def __monkeypatch_wx__CallAfter(mod):
- print 'lololmonkeypatch'
- import wx
- wx.CallAfter = mod.CallAfterCombining
-
- __monkeypatch_wx__CallAfter = peak.whenImported('events')(__monkeypatch_wx__CallAfter)
-
- import __builtin__
-
- class Sentinel:
-
- def __init__(self, *a, **k):
- pass
-
-
- def __repr__(self):
- return '<Sentinel %s>' % id(self)
-
-
- def __nonzero__(self):
- return False
-
-
- __builtin__.Sentinel = Sentinel
- __builtin__.sentinel = Sentinel()
- sys.modules['psyco'] = None
- restricted_names = frozenset([
- 'password',
- 'secret',
- 'pass',
- 'passwd'])
- OMITTED = '<OMITTED>'
- VALUE_LENGTH_LIMIT = 360
-
- def formatexception(excinfo = None, lastframes = 8):
- import StringIO
- import traceback
- if excinfo is None:
- excinfo = sys.exc_info()
-
- s = StringIO.StringIO()
- tb = excinfo[2]
- stack = []
- if tb is not None:
- while True:
- if not tb.tb_next:
- break
-
- tb = tb.tb_next
- f = tb.tb_frame
- while f:
- stack.append(f)
- f = f.f_back
-
- stack.reverse()
- if len(stack) > lastframes:
- stack = stack[-lastframes:]
-
- print >>s, '\nVariables by last %d frames, innermost last' % (lastframes,)
- restricted_values = []
- for frame in stack:
- print >>s, ''
- print >>s, ' File "%s", line %d, in %s' % (frame.f_code.co_filename, frame.f_lineno, frame.f_code.co_name)
- for key, value in frame.f_locals.items():
- if type(value) == type(sys):
- continue
-
- if key == '__builtins__':
- continue
-
- for badthing in restricted_names:
- if badthing in key and value:
- restricted_values.append(value)
- value = OMITTED
- continue
-
- print >>s, '%15s = ' % (key,),
-
- try:
- if isinstance(value, type({ })) and value:
- valstring = []
- for _kk, _vv in sorted(value.items()):
- if _kk == '__builtins__':
- continue
-
- if (any,)((lambda .0: for x in .0:
- x in _kk)(restricted_names)) and _vv:
- valstring.append('%s=%r' % (_kk, OMITTED))
- restricted_values.append(_vv)
- continue
- valstring.append('%s=%r' % (_kk, _vv))
-
- valstring = ' '.join(valstring)[:VALUE_LENGTH_LIMIT]
- print >>s, valstring,
- else:
- print >>s, repr(value)[:VALUE_LENGTH_LIMIT]
- continue
- print >>s, '(Exception occurred printing value)'
- continue
-
-
-
- traceback.print_exception(*excinfo, **{
- 'file': s })
- retval = s.getvalue()
- if isinstance(retval, unicode):
- retval_str = retval.encode('utf-8', 'replace')
- else:
- retval_str = retval
- for value in restricted_values:
- if not value or value == OMITTED:
- continue
-
-
- try:
- value_type = type(value)
- if issubclass(value_type, basestring):
- if issubclass(value_type, unicode):
- value_str = value.encode('utf-8', 'replace')
- elif issubclass(value_type, str):
- value_str = value
-
- retval_str = retval_str.replace(value_str, OMITTED)
-
- retval_str = retval_str.replace(repr(value)[:VALUE_LENGTH_LIMIT], OMITTED)
- continue
- except UnicodeError:
- continue
- continue
-
-
-
- return retval
-
- import traceback
- traceback._old_print_exc = traceback.print_exc
- traceback._old_format_exc = traceback.format_exc
-
- def print_exc(limit = None, file = None):
-
- try:
- if file is None:
- file = sys.stderr
-
- formattedexc = formatexception()
- file.write(formattedexc)
- except:
- traceback._old_print_exc()
-
-
- traceback.print_exc = print_exc
-
- def format_exc():
-
- try:
- return formatexception()
- except:
- return traceback._old_format_exc()
-
-
- traceback.format_exc = formatexception
-
- def eh(*args):
-
- try:
- print >>sys.stderr, formatexception(args)
- except:
- print >>sys.stderr, args
-
-
- if True:
- sys.excepthook = eh
-
- del traceback
-
- class NullType(object):
-
- def __new__(cls, *args, **kwargs):
- if '_inst' not in vars(cls):
- cls._inst = object.__new__(cls, *args, **kwargs)
-
- return cls._inst
-
-
- def __init__(self, *args, **kwargs):
- pass
-
-
- def __call__(self, *args, **kwargs):
- return self
-
-
- def __repr__(self):
- return '<Null>'
-
-
- def __nonzero__(self):
- return False
-
-
- def __getattr__(self, name):
- return self
-
-
- def __setattr__(self, name, value):
- return self
-
-
- def __delattr__(self, name):
- return self
-
-
- __builtin__.Null = NullType()
- del NullType
- find_library = None
- if os.name == 'nt':
-
- def find_library(name):
- for directory in sys.path + os.environ['PATH'].split(os.pathsep):
- fname = os.path.join(directory, name)
- if os.path.exists(fname):
- return fname
-
- if fname.lower().endswith('.dll'):
- continue
-
- fname = fname + '.dll'
- if os.path.exists(fname):
- return fname
- continue
-
-
-
- if find_library is not None:
- import ctypes.util as ctypes
- ctypes.util.find_library = find_library
-
- del find_library
-